<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查询isbn</title>
    <script src="js\Jquery3.1.1.js"></script>
    <script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script src="layui/lay/modules/layer.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="layui/css/modules/layer/default/layer.css"/>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
    <style>

    </style>
</head>
<body >

<table >
    <thead>
    <tbody>
        ${tbody}
    </tbody>
</table>
<script>

    var ip = "";
    var port = "";
    $.ajax({
        url: 'getIPandPort',
        async: false,
        success: function (res) {
            port = res.port;
            ip = res.ip;
        }
    });
    var ws = new WebSocket("ws://" + ip + ":" + port + "/sokect");
    ws.onopen = function () {
        console.log("连接成功")
        $("#connectionStatus").html("连接成功");
        $("#btnStart").removeClass("layui-btn-disabled");
    }
    ws.onmessage = function (evt) {
        var msg = JSON.parse(evt.data);
        console.log(msg);
    };
    ws.onclose = function () {
        layer.alert("socket服务器断了");
    };


</script>

</body>
</html>